package com.member.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizRechargeUser;
import com.member.shop.mapper.SysBizRechargeUserMapper;
import com.member.shop.service.ISysBizRechargeUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 用户充值Service业务层处理
 *
 * @author lixinchen
 * @date 2024-05-08
 */
@Service
public class SysBizRechargeUserServiceImpl extends ServiceImpl<SysBizRechargeUserMapper, SysBizRechargeUser> implements ISysBizRechargeUserService {
    @Resource
    private SysBizRechargeUserMapper sysBizRechargeUserMapper;

    /**
     * 查询用户充值
     *
     * @param id 用户充值主键
     * @return 用户充值
     */
    @Override
    public SysBizRechargeUser selectSysBizRechargeUserById(Long id) {
        return sysBizRechargeUserMapper.selectById(id);
    }

    /**
     * 查询用户充值列表
     *
     * @param sysBizRechargeUser 用户充值
     * @return 用户充值
     */
    @Override
    public List<SysBizRechargeUser> selectSysBizRechargeUserList(LambdaQueryWrapper<SysBizRechargeUser> queryWrapper) {
        return sysBizRechargeUserMapper.selectList(queryWrapper);
    }

    /**
     * 新增用户充值
     *
     * @param sysBizRechargeUser 用户充值
     * @return 结果
     */
    @Override
    public int insertSysBizRechargeUser(SysBizRechargeUser sysBizRechargeUser) {
        sysBizRechargeUser.setCreateTime(DateUtils.getNowDate());
        return sysBizRechargeUserMapper.insert(sysBizRechargeUser);
    }

    /**
     * 修改用户充值
     *
     * @param sysBizRechargeUser 用户充值
     * @return 结果
     */
    @Override
    public int updateSysBizRechargeUser(SysBizRechargeUser sysBizRechargeUser) {
        sysBizRechargeUser.setUpdateTime(DateUtils.getNowDate());
        return sysBizRechargeUserMapper.updateById(sysBizRechargeUser);
    }

    /**
     * 批量删除用户充值
     *
     * @param ids 需要删除的用户充值主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRechargeUserByIds(Long[] ids) {
        return sysBizRechargeUserMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户充值信息
     *
     * @param id 用户充值主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRechargeUserById(Long id) {
        return sysBizRechargeUserMapper.deleteById(id);
    }

    /**
     * 查询用户充值列表
     *
     * @param sysBizRechargeUser 用户充值
     * @return 用户充值
     */
    @Override
    public List<SysBizRechargeUser> selectSysBizRechargeUserList(SysBizRechargeUser sysBizRechargeUser) {
        return sysBizRechargeUserMapper.selectSysBizRechargeUserList(sysBizRechargeUser);
    }
}
